//---------------------------------------------------------------------------

#include "vcl_stl.h"
#pragma hdrstop

#include "h_base.h"
#include "h_xml.h"
#include "h_global.h"
using namespace h_base;
using namespace h_xml;

#include "h_stage.h"
#include "t_dummyform.h"

#include "t_connectorform.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TConnectorForm *ConnectorForm;
//---------------------------------------------------------------------------
__fastcall TConnectorForm::TConnectorForm(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TConnectorForm::ButtonOkClick(TObject *Sender)
{
   UTF8String ErrorString;

   Info.HideArrow = CheckBoxHideArrow->Checked;

   if( !FStage->SetInfo(Info, ErrorString) )
   {
      ShowMessage(ErrorString);
      return;
   }

   OkFlag = true;
   Close();
}
//---------------------------------------------------------------------------
void __fastcall TConnectorForm::ButtonCancelClick(TObject *Sender)
{
   Close();
}
//---------------------------------------------------------------------------

bool __fastcall TConnectorForm::Edit(HStageConnector *Stage)
{
   FStage = Stage;
   FStage->GetInfo(Info);
   UTF8String Cap;
   Cap.sprintf(UTF8String(DummyForm->PropertiesOf->Caption).c_str(),
      Stage->GetName().c_str());
   Caption = Cap;
   CheckBoxHideArrow->Checked = Info.HideArrow;
   OkFlag = false;

   ShowModal();

   if( !OkFlag )
      return false;

   return true;
}

